<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<div id="header">
    <div id="title">
        <nav class="navbar navbar-default navbar-fixed-top">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="http://weibo.com/fuyongde">帅气的Jason</a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

                    <ul class="nav navbar-nav navbar-right">
                        <shiro:user>
                            <shiro:hasAnyRoles name="boss,admin,manager,user">
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">商品管理<span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="${ctx}/merchandise">所有商品</a></li>
                                        <li><a href="${ctx}/merchandise/create">添加商品</a></li>
                                    </ul>
                                </li>
                            </shiro:hasAnyRoles>
                            <shiro:hasAnyRoles name="boss,admin,manager">
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">订单管理<span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="${ctx}/order">所有订单</a></li>
                                        <li><a href="${ctx}/order/create">添加订单</a></li>
                                    </ul>
                                </li>
                            </shiro:hasAnyRoles>
                            <shiro:hasAnyRoles name="boss,admin">
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">员工管理<span class="caret"></span></a>
                                    <ul class="dropdown-menu">
                                        <li><a href="${ctx}/register">添加员工</a></li>
                                    </ul>
                                </li>
                            </shiro:hasAnyRoles>

                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">公司信息<span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <shiro:hasAnyRoles name="boss,admin">
                                    <li><a href="${ctx}/merchant/update">修改信息</a></li>
                                    <li class="divider"></li>
                                    </shiro:hasAnyRoles>
                                    <shiro:hasAnyRoles name="boss,admin,manager,user">
                                    <li><a href="${ctx}/merchant/detail">公司详情</a></li>
                                    </shiro:hasAnyRoles>
                                </ul>
                            </li>

                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><shiro:principal property="username"/><span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="${ctx}/account/profile">个人资料</a></li>
                                    <li><a href="${ctx}/account/update">修改信息</a></li>
                                    <li><a href="${ctx}/logout">退出</a></li>
                                </ul>
                            </li>
                        </shiro:user>
                        <shiro:guest>
                            <li><a href="${ctx}/login">登陆</a></li>
                        </shiro:guest>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</div>